package com.gopay.common.user.dao.impl;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.constants.cust.OprStatConstants;
import com.gopay.common.domain.user.CauthOperatorInfo;
import com.gopay.common.user.dao.OprInfoQueryDAO;
import com.gopay.common.util.DateUtils;


@Repository("oprInfoQueryDao")
public class OprInfoQueryDAOImpl extends BaseDAOImpl<CauthOperatorInfo, Serializable> implements OprInfoQueryDAO {

	@Override
	public List<CauthOperatorInfo> getDueOpr(String date) {
//    	return getHibernateTemplate().find("from CauthOperatorInfo s where to_date(s.lastValidityDay,'yyyyMMdd')<=? and s.operStatus!=?",new Object[]{DateUtils.strToDate(date,"yyyyMMdd"),OprStatConstants.OPR_STATE_DUE_LOCK});
		String hql = "from CauthOperatorInfo s where to_date(s.lastValidityDay,'yyyyMMdd')<=:lastValidityDay and s.operStatus!=:operStatus";
		Map<String, Object> param = new HashMap<String, Object>(); 
		param.put("lastValidityDay", DateUtils.strToDate(date,"yyyyMMdd"));
		param.put("operStatus", OprStatConstants.OPR_STATE_DUE_LOCK);
		return findByHql(hql, param);
	}

}

